/**
 * @file /include/car_sim/main_window.hpp
 *
 * @brief Qt based gui for car_sim.
 *
 * @date November 2010
 **/
#ifndef car_sim_MAIN_WINDOW_H
#define car_sim_MAIN_WINDOW_H

/*****************************************************************************
** Includes
*****************************************************************************/

//#include <QtGui/QMainWindow>
#include <QtWidgets/QMainWindow>
#include "ui_main_window.h"
#include "qnode.hpp"
#include <map>
#include "CCtrlDashBoard.h"

/*****************************************************************************
** Namespace
*****************************************************************************/

namespace car_sim {

/*****************************************************************************
** Interface [MainWindow]
*****************************************************************************/
/**
 * @brief Qt central, all operations relating to the view part here.
 */
class MainWindow : public QMainWindow {
Q_OBJECT

public:
	MainWindow(int argc, char** argv, QWidget *parent = 0);
	~MainWindow();

	void ReadSettings(); // Load up qt program settings at startup
	void WriteSettings(); // Save qt program settings when closing

	void closeEvent(QCloseEvent *event); // Overloaded function
	void showNoMasterMessage();

public Q_SLOTS:
	/******************************************
	** Auto-connections (connectSlotsByName())
	*******************************************/
	void on_actionAbout_triggered();
	void on_button_connect_clicked(bool check );
	void on_checkbox_use_environment_stateChanged(int state);

    /******************************************
    ** Manual connections
    *******************************************/
    void updateLoggingView(); // no idea why this can't connect automatically

    /******************************************************************************************************************************************************
     * My Code Below ***************************************************************************************************************************************
     * ******************************************************************************************************************************************************/

private slots:
    void on_horizontalSlider_acc_valueChanged(int value);

    void on_horizontalSlider_turning_valueChanged(int value);

    void slot_pushbtn_click();

    void slot_update_dashboard(float, float);

    /******************************************************************************************************************************************************
     * My Code Above ---------------------------------------------------------------------------------------------------------------------------------------
     * ******************************************************************************************************************************************************/

private:
	Ui::MainWindowDesign ui;
	QNode qnode;

    /******************************************************************************************************************************************************
     * My Code Below ***************************************************************************************************************************************
     * ******************************************************************************************************************************************************/

protected:
    virtual void keyPressEvent(QKeyEvent *event);
    virtual void keyReleaseEvent(QKeyEvent *event);

private:
    //仪表盘
    CCtrlDashBoard *speed_x_dashBoard;
    CCtrlDashBoard *speed_y_dashBoard;
    /******************************************************************************************************************************************************
     * My Code Above ---------------------------------------------------------------------------------------------------------------------------------------
     * ******************************************************************************************************************************************************/
};

}  // namespace car_sim

#endif // car_sim_MAIN_WINDOW_H
